@import "../../themes/ionic.globals.ios";

// iOS Card
// --------------------------------------------------

/// @prop - Margin top of the card
$card-ios-margin-top:                  12px !default;

// deprecated
$card-ios-margin-right:                12px !default;
/// @prop - Margin end of the card
$card-ios-margin-end:                  $card-ios-margin-right !default;

/// @prop - Margin bottom of the card
$card-ios-margin-bottom:               12px !default;

// deprecated
$card-ios-margin-left:                 12px !default;
/// @prop - Margin start of the card
$card-ios-margin-start:                $card-ios-margin-left !default;

/// @prop - Padding top of the card
$card-ios-padding-top:                 13px !default;

// deprecated
$card-ios-padding-right:               16px !default;
/// @prop - Padding end of the card
$card-ios-padding-end:                 $card-ios-padding-right !default;

/// @prop - Padding bottom of the card
$card-ios-padding-bottom:              14px !default;

// deprecated
$card-ios-padding-left:                16px !default;
/// @prop - Padding start of the card
$card-ios-padding-start:               $card-ios-padding-left !default;

/// @prop - Padding top of the media on the card
$card-ios-padding-media-top:           10px !default;

/// @prop - Padding bottom of the media on the card
$card-ios-padding-media-bottom:        9px !default;

/// @prop - Background color of the card
$card-ios-background-color:            $list-ios-background-color !default;

/// @prop - Box shadow color of the card
$card-ios-box-shadow-color:            rgba(0, 0, 0, .3) !default;

/// @prop - Box shadow of the card
$card-ios-box-shadow:                  0 1px 2px $card-ios-box-shadow-color !default;

/// @prop - Border radius of the card
$card-ios-border-radius:               2px !default;

/// @prop - Font size of the card
$card-ios-font-size:                   1.4rem !default;

/// @prop - Color of the card text
$card-ios-text-color:                  #666 !default;

/// @prop - Font size of the card title
$card-ios-title-font-size:             1.8rem !default;

// deprecated
$card-ios-title-padding:               null !default;

/// @prop - Padding top of the card title
$card-ios-title-padding-top:           8px !default;

/// @prop - Padding end of the card title
$card-ios-title-padding-end:           0 !default;

/// @prop - Padding bottom of the card title
$card-ios-title-padding-bottom:        8px !default;

/// @prop - Padding start of the card title
$card-ios-title-padding-start:         0 !default;

// deprecated
$card-ios-title-margin:                null !default;

/// @prop - Margin top of the card title
$card-ios-title-margin-top:            2px !default;

/// @prop - Margin end of the card title
$card-ios-title-margin-end:            0 !default;

/// @prop - Margin bottom of the card title
$card-ios-title-margin-bottom:         2px !default;

/// @prop - Margin start of the card title
$card-ios-title-margin-start:          0 !default;

/// @prop - Color of the card title
$card-ios-title-text-color:            #222 !default;

/// @prop - Font size of the card header
$card-ios-header-font-size:            1.6rem !default;

/// @prop - Font weight of the card header
$card-ios-header-font-weight:          500 !default;

// deprecated
$card-ios-header-padding:              null !default;

/// @prop - Padding top of the card header
$card-ios-header-padding-top:          16px !default;

/// @prop - Padding end of the card header
$card-ios-header-padding-end:          $card-ios-header-padding-top !default;

/// @prop - Padding bottom of the card header
$card-ios-header-padding-bottom:       $card-ios-header-padding-top !default;

/// @prop - Padding start of the card header
$card-ios-header-padding-start:        $card-ios-header-padding-end !default;

/// @prop - Color of the card header
$card-ios-header-color:                #333 !default;


.card-ios {
  @include margin($card-ios-margin-top, $card-ios-margin-end, $card-ios-margin-bottom, $card-ios-margin-start);
  @include border-radius($card-ios-border-radius);

  width: calc(100% - #{($card-ios-margin-end + $card-ios-margin-start)});

  font-size: $card-ios-font-size;

  background: $card-ios-background-color;
  box-shadow: $card-ios-box-shadow;
}

.card-ios ion-list {
  @include margin(null, null, 0, null);
}

.card-ios > .item:last-child,
.card-ios > .item:last-child .item-inner,
.card-ios > .item-wrapper:last-child .item {
  border-bottom: 0;
}

.card-ios .item-ios.item-block .item-inner {
  border: 0;
}

.card-content-ios {
  @include padding($card-ios-padding-top, $card-ios-padding-end, $card-ios-padding-bottom, $card-ios-padding-start);

  font-size: $card-ios-font-size;
  line-height: 1.4;
}

.card-header-ios {
  font-size: $card-ios-header-font-size;
  font-weight: $card-ios-header-font-weight;
  color: $card-ios-header-color;

  @include deprecated-variable(padding, $card-ios-header-padding) {
    @include padding($card-ios-header-padding-top, $card-ios-header-padding-end, $card-ios-header-padding-bottom, $card-ios-header-padding-start);
  }
}

.card-header-ios + .card-content-ios,
.card-ios .item + .card-content-ios {
  @include padding(0, null, null, null);
}

.card .note-ios {
  font-size: 1.3rem;
}

.card-title-ios {
  display: block;

  font-size: $card-ios-title-font-size;
  line-height: 1.2;
  color: $card-ios-title-text-color;

  @include deprecated-variable(margin, $card-ios-title-margin) {
    @include margin($card-ios-title-margin-top, $card-ios-title-margin-end, $card-ios-title-margin-bottom, $card-ios-title-margin-start);
  }

  @include deprecated-variable(padding, $card-ios-title-padding) {
    @include padding($card-ios-title-padding-top, $card-ios-title-padding-end, $card-ios-title-padding-bottom, $card-ios-title-padding-start);
  }
}

.card-ios h1 {
  @include margin(0, 0, 2px);

  font-size: 2.4rem;
  font-weight: normal;
}

.card-ios h2 {
  @include margin(2px, 0);

  font-size: 1.6rem;
  font-weight: normal;
}

.card-ios h3,
.card-ios h4,
.card-ios h5,
.card-ios h6 {
  @include margin(2px, 0);

  font-size: 1.4rem;
  font-weight: normal;
}

.card-ios p {
  @include margin(0, 0, 2px);

  font-size: 1.4rem;
  color: $card-ios-text-color;
}

.card-ios + ion-card {
  @include margin(0, null, null, null);
}


// Generate iOS Card Colors
// --------------------------------------------------

@each $color-name, $color-base, $color-contrast in get-colors($colors-ios) {

  .card-ios .text-ios-#{$color-name} {
    color: $color-base;
  }

  .card-ios-#{$color-name} {
    color: $color-contrast;
    background-color: $color-base;

    .card-header-ios,
    .card-title-ios,
    .card-content-ios,
    p {
      color: $color-contrast;
    }

    @each $color-name, $color-base, $color-contrast in get-colors($colors-ios) {
      .text-ios-#{$color-name},
      .card-header-ios-#{$color-name},
      .card-title-ios-#{$color-name},
      .card-content-ios-#{$color-name} {
        color: $color-base;
      }
    }
  }

  .card-header-ios-#{$color-name},
  .card-title-ios-#{$color-name},
  .card-content-ios-#{$color-name} {
    color: $color-base;
  }

}
